package org.example.design.command.test2.drawer;

import org.example.design.command.test2.command.Command;

import java.awt.*;

/**
 * @author huangshen
 * @version 0
 * @description 绘制一个点的命令
 * @since 2022/2/14 13:47
 */
public class DrawCommand implements Command {

    /**
     * 绘制对象
     */
    protected Drawable drawable;
    /**
     * 绘制位置
     */
    private final Point position;

    public DrawCommand(Drawable drawable, Point position) {
        this.drawable = drawable;
        this.position = position;
    }

    /**
     * 执行
     */
    @Override
    public void execute() {
        drawable.draw(position.x, position.y);
    }
}
